<?php
header("Content-type: text/html; charset=utf-8");
error_reporting(E_ALL);
ini_set('display_errors', 1);
set_time_limit(0);
include_once dirname(dirname(__FILE__)) . '/mgtv_init.php';
class update_seekpoint_data extends nn_timer
{

	public function action($params = null)
	{
		$this->msg('开始执行...');
		do_timer_action();
		$this->msg('执行结束...');
	}
}
$update_seekpoint_data = new update_seekpoint_data("update_seekpoint_data", 'public',__FILE__);
$update_seekpoint_data->run();

function do_timer_action()
{
	$db_r = nn_get_db(NL_DB_READ);
	$db_w = nn_get_db(NL_DB_WRITE);
	
	$sql = "select nns_video_index,nns_video_id,nns_end from nns_vod_index_seekpoint where nns_type='2'";
	
	$video_info = nl_db_get_all($sql, $db_r);
	
	if ($video_info)
	{
		foreach ($video_info as $value)
		{
			$sql = "select nns_time_len from nns_vod_index where nns_index='{$value['nns_video_index']}' and nns_vod_id='{$value['nns_video_id']}'";
			$index_info = nl_db_get_all($sql, $db_r);
			$str_sql = "update nns_vod_index_seekpoint set nns_begin='{$value['nns_end']}',nns_end='{$index_info[0]['nns_time_len']}' where nns_type='2' and nns_video_id='{$value['nns_video_id']}' and nns_video_index='{$value['nns_video_index']}'";
			nl_execute_by_db($str_sql, $db_w);
		}
	}
}






